////////////////////////////////////////////////////////////////////////////////
// Copyright 2006 CORE Solutions Limited
// All rights reserved.
// PROPRIETARY AND CONFIDENTIAL INFORMATION.
// Use is subject to license terms.
//
// FUNCTION ID      :   ROLE_GROUP
// AUTHOR           :   Victor Zheng 
// DATE CREATE      :   2006/02/01
// DESCRIPTION      :   a FORM file for the function, ROLE_GROUP
//                  :   
//                  :   
//                  :   
//
// MODIFICATION HISTORY:
// DATE         AUTHOR          VERSION NO.         COMMENT
// -----------  --------------  ------------------  -------------------
// 2006/02/01   Victor Zheng    1.0                 source is generated.
//
//
//
////////////////////////////////////////////////////////////////////////////////

package com.erp.app.admin.roleGroupSetup.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import com.erp.framework.controller.form.SimplePageEditStyleForm;
import com.erp.framework.util.logger.Logger;

import com.erp.app.common.ProjectConstants;
import com.erp.app.util.web.ActionErrorUtil;
import com.erp.framework.util.CommonUtil;
import com.erp.framework.model.schema.TableSchema;


/**
* <p>A <strong>PageEditForm</strong> is a JavaBean which provides property
* getter and setter methods for all of the bean properties, and implements
* <code>Serializable</code>, as required by the JavaBean specification
* The main purpose for this bean is to get the user search criteria input
* and to get the user input from the web browsers.
* from the web browsers.
* As the name implies, it will only handle one-page-edit documents.
*
* @author          Victor Zheng 
* @version 1.0     2006/02/01
* @since           FrameWork 1.0
*
*/
public class RoleGroupForm extends SimplePageEditStyleForm {

	//Attributes (DB Table Name: T_ROLE_GROUP)
	private String[] companyCode;                    //DB Column Name: COMPANY_CODE
	private String[] roleGroupId;                    //DB Column Name: ROLE_GROUP_ID
	private String[] description;                    //DB Column Name: DESCRIPTION
	private String[] createUser;                     //DB Column Name: CREATE_USER
	private String[] createDate;                     //DB Column Name: CREATE_DATE
	private String[] updateUser;                     //DB Column Name: UPDATE_USER
	private String[] updateDate;                     //DB Column Name: UPDATE_DATE
	private String[] status;                         //DB Column Name: STATUS
	private String[] showCost;

	//Searching Criteria Attributes (DB Table Name: T_ROLE_GROUP)
	private String srchCompanyCode;                  //DB Column Name: COMPANY_CODE
	private String srchStatus;                       //DB Column Name: STATUS
	private String srchRoleGroupIdFr;                //DB Column Name: ROLE_GROUP_ID
	private String srchRoleGroupIdTo;                //DB Column Name: ROLE_GROUP_ID
	private String srchDescriptionFr;                //DB Column Name: DESCRIPTION
	private String srchDescriptionTo;                //DB Column Name: DESCRIPTION

	/**
	* Converts to a string representing the data in this object.
	* A new <code>String</code> object is allocated and initialized to 
	* contain the character sequence currently represented by this 
	* object. This <code>String</code> is then returned. Subsequent 
	* changes to this object do not affect the contents of the 
	* <code>String</code>. 
	*
	* @return     a string representation of the object.
	* @see        java.lang.Object#toString()
	* @author     Victor Zheng 
	* @since      FrameWork 1.0
	*/
	public String toString() {
		String pkStr = "PK: {srchRoleGroupIdFr = " + this.srchRoleGroupIdFr
			+ "\n, srchRoleGroupIdTo = " + this.srchRoleGroupIdTo + "}\n";

		String colStr = "COL: {srchDescriptionFr = " + this.srchDescriptionFr
			+ "\n, srchDescriptionTo = " + this.srchDescriptionTo + "}\n";

		String mandatoryStr = "{srchCompanyCode = " + this.srchCompanyCode
			+ "\n, srchStatus = " + this.srchStatus
			+ "}\n";

		return "toString() is:\n" + mandatoryStr + pkStr + colStr;
	}

	
	/**
	* Validate the properties that have been set for this non-HTTP request,
	* and return an <code>ActionErrors</code> object that encapsulates any
	* validation errors that have been found.  If no errors are found, return
	* <code>null</code> or an <code>ActionErrors</code> object with no
	* recorded error messages.
	* <p>
	* The default implementation attempts to forward to the HTTP version of
	* this method.
	*
	* @param      the action errors array
	* @author     Victor Zheng 
	* @since      FrameWork 1.0
	*/
	public void otherValidate(ActionErrors errors) {
        
        TableSchema ts = getTs();
        String validateFeildName = new String();

		try {
            for (int i = 0 ;i < roleGroupId.length ; i++){
                
                validateFeildName = ts.getDisplayWebLabelByObjectId("LBL_GRID_ROLE_GROUP_ID");
                if (CommonUtil.isEmpty(roleGroupId[i])){
                    ActionErrorUtil.addErrorForGeneralFieldBlank(errors, validateFeildName);
                }
            }


		} catch (Exception e) {
			Logger.logExceptions(this, e);
		}
	}

	/**
	* Validate the properties that have been set for this non-HTTP request,
	* and return an <code>ActionErrors</code> object that encapsulates any
	* validation errors that have been found.  If no errors are found, return
	* <code>null</code> or an <code>ActionErrors</code> object with no
	* recorded error messages.
	* <p>
	* The default implementation attempts to forward to the HTTP version of
	* this method.
	*
	* @param      mapping      the action mapping
	* @param      formIn       the action form
	* @param      request      the http request
	* @param      response     the http response
	* @param      errors       the action errors array
	* @author     Victor Zheng 
	* @since      FrameWork 1.0
	*/
	public void moreValidate(ActionMapping mapping, ActionForm formIn,
		HttpServletRequest request, HttpServletResponse response, ActionErrors errors) {

		try {

		} catch (Exception e) {
			Logger.logExceptions(this, e);
		}
	}

	/**
	* Validate the properties that have been set for this non-HTTP request,
	* and return an <code>ActionErrors</code> object that encapsulates any
	* validation errors that have been found.  If no errors are found, return
	* <code>null</code> or an <code>ActionErrors</code> object with no
	* recorded error messages.
	* <p>
	* The default implementation attempts to forward to the HTTP version of
	* this method.
	*
	* @param      the action errors array
	* @author     Victor Zheng 
	* @since      FrameWork 1.0
	*/
	public void validateSearch(ActionErrors errors) {

		try {

		} catch (Exception e) {
			Logger.logExceptions(this, e);
		}
	}

	/**
	* Validate the properties that have been set for this non-HTTP request,
	* and return an <code>ActionErrors</code> object that encapsulates any
	* validation errors that have been found.  If no errors are found, return
	* <code>null</code> or an <code>ActionErrors</code> object with no
	* recorded error messages.
	* <p>
	* The default implementation attempts to forward to the HTTP version of
	* this method.
	*
	* @param      mapping      the action mapping
	* @param      formIn       the action form
	* @param      request      the http request
	* @param      response     the http response
	* @param      errors       the action errors array
	* @author     Victor Zheng 
	* @since      FrameWork 1.0
	*/
	public void moreValidateSearch(ActionMapping mapping, ActionForm formIn,
		HttpServletRequest request, HttpServletResponse response, ActionErrors errors) {

		try {

		} catch (Exception e) {
			Logger.logExceptions(this, e);
		}
	}

	/**
	* Reset all bean properties to their default state.  This method
	* is called inside the reset() method.
	*
	* @param      mapping The mapping used to select this instance
	* @param      request The servlet request we are processing
	* @author     Victor Zheng 
	* @since      FrameWork 1.0
	*/
	public void otherReset(ActionMapping mapping, HttpServletRequest request) {

		setRowMode(null);
		setIdx(null);
		//companyCode = null;
		//srchCompanyCode = null;
	}

	////////////////////////////////////////////////////////////////////////////////
	//Generated Accessors (get/set methods) for Table (RoleGroup)
	////////////////////////////////////////////////////////////////////////////////

	public String[] getCompanyCode() {
		return this.companyCode;
	}

	public String[] getRoleGroupId() {
		return this.roleGroupId;
	}

	public String[] getDescription() {
		return this.description;
	}

	public String[] getCreateUser() {
		return this.createUser;
	}

	public String[] getCreateDate() {
		return this.createDate;
	}

	public String[] getUpdateUser() {
		return this.updateUser;
	}

	public String[] getUpdateDate() {
		return this.updateDate;
	}

	public String[] getStatus() {
		return this.status;
	}
	
	public String[] getShowCost() { return showCost; }

	public void setCompanyCode(String[] companyCode) {
		this.companyCode = companyCode;
	}

	public void setRoleGroupId(String[] roleGroupId) {
		this.roleGroupId = roleGroupId;
	}

	public void setDescription(String[] description) {
		this.description = description;
	}

	public void setCreateUser(String[] createUser) {
		this.createUser = createUser;
	}

	public void setCreateDate(String[] createDate) {
		this.createDate = createDate;
	}

	public void setUpdateUser(String[] updateUser) {
		this.updateUser = updateUser;
	}

	public void setUpdateDate(String[] updateDate) {
		this.updateDate = updateDate;
	}

	public void setStatus(String[] status) {
		this.status = status;
	}

	////////////////////////////////////////////////////////////////////////////////
	//Generated Accessors (get/set methods) for searching criterias
	////////////////////////////////////////////////////////////////////////////////

	public String getSrchCompanyCode() {
		return this.srchCompanyCode;
	}

	public String getSrchStatus() {
		return this.srchStatus;
	}

	public String getSrchRoleGroupIdFr() {
		return this.srchRoleGroupIdFr;
	}

	public String getSrchRoleGroupIdTo() {
		return this.srchRoleGroupIdTo;
	}

	public String getSrchDescriptionFr() {
		return this.srchDescriptionFr;
	}

	public String getSrchDescriptionTo() {
		return this.srchDescriptionTo;
	}

	public void setSrchCompanyCode(String srchCompanyCode) {
		this.srchCompanyCode = srchCompanyCode;
	}

	public void setSrchStatus(String srchStatus) {
		this.srchStatus = srchStatus;
	}

	public void setSrchRoleGroupIdFr(String srchRoleGroupIdFr) {
		this.srchRoleGroupIdFr = srchRoleGroupIdFr;
	}

	public void setSrchRoleGroupIdTo(String srchRoleGroupIdTo) {
		this.srchRoleGroupIdTo = srchRoleGroupIdTo;
	}

	public void setSrchDescriptionFr(String srchDescriptionFr) {
		this.srchDescriptionFr = srchDescriptionFr;
	}

	public void setSrchDescriptionTo(String srchDescriptionTo) {
		this.srchDescriptionTo = srchDescriptionTo;
	}

	public void setShowCost(String[] showCost) { this.showCost = showCost; }
	
	////////////////////////////////////////////////////////////////////////////////
	//Other Accessors (get/set methods)
	////////////////////////////////////////////////////////////////////////////////


}